package com.m2dl.tpcsa.touchmycircle.common;

import java.util.ArrayList;

/**
 * Manages the application score. This is a static class, for this moment. Help
 * to the persistence of the data.
 */
public class Score {
	/** List of all scores of the TMCGame. */
	private ArrayList<Integer> currentScore = null;

	/** The current session score of the TMCGame. */

	public Score() {
		this.currentScore = new ArrayList<Integer>();
	}

	/** Gets the current score. */
	public ArrayList<Integer> getCurrentScore() {
		return currentScore;
	}

	/** Adds a score to the current score. */
	public void addAScore(int newScore) {
		this.currentScore.add(newScore);
	}

	/** Gets size of the application. */
	public int getSize() {
		return this.currentScore.size();
	}

	/** Gets the specific score with the specific index. */
	public int getSpecificScore(int position) {
		return this.currentScore.get(position);
	}

	public int computeScore() {
		int finalScore = 0;
		System.out.println("---------------------------- Taille: "	+ this.currentScore.size());
		for (int score : this.currentScore) {
			if (score > 0) {
				finalScore += (100 - score);
			} else {
					finalScore -= 10;
			}
			System.out.println("---------------------------- score: " + score);
		}
		return finalScore;
	}
}
